package com.ykqx.weather.app.controller;


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ykqx.weather.dto.AppUpdate;
import com.ykqx.weather.service.AppUpdateService;

import com.ykqx.weather.service.FYLZService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/ykqx")
public class AppUpdateInterface {

    Gson gson = new GsonBuilder().create();

    @Autowired
    AppUpdateService appUpdateService;
    @Autowired
    FYLZService fylzService;

    @RequestMapping(value = "/updateApp", produces = "text/html;charset=utf-8")
    @ResponseBody
    public String updateApp(){
        return gson.toJson(appUpdateService.updateApp());
    }

    @RequestMapping(value = "/addAppInf", produces = "text/html;charset=utf-8")
    @ResponseBody
    public String addAppInf(String version) {
        return appUpdateService.addAppInf(version);
    }

    @RequestMapping(value = "/setAppUpdateAdmin", produces = "text/html;charset=utf-8")
    @ResponseBody
    public String setAppUpdateAdmin(String status, String version){
        return appUpdateService.setAppUpdateAdmin(status, version);
    }

    @RequestMapping(value = "/getFYLZ", produces = "text/html;charset=utf-8")
    @ResponseBody
    public String getFYLZ() {
        return fylzService.getFYLZ();
    }

    @RequestMapping(value = "/getFYLZ24", produces = "text/html;charset=utf-8")
    @ResponseBody
    public String getFYLZ24() {
        return fylzService.getFYLZ();
    }

}
